﻿using System;

namespace OpenGameKit
{
    public static class GameMath
    {
        /// <summary>
        /// Returns the angle between two points as a double.
        /// </summary>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <returns></returns>
        public static double LookAt(double x1, double y1, double x2, double y2)
        {
            double x = x2 - x1;
            double y = y2 - y1;

            return Math.Atan2(y, x) / Math.PI * 180;
        }

        /// <summary>
        /// Returns the distance between two points as a double.
        /// </summary>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <returns></returns>
        public static double GetDistance(double x1, double y1, double x2, double y2)
        {
            double i = Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2));
            return i;
        }

        public static int Random(int min, int max)
        {
            System.Random R = new Random();
            return R.Next(min, max);
        }
    }
}
